﻿
 (function () {
    appModule.controller('common.views.workFlows.createOrEditModal', [
         '$scope', '$uibModalInstance', 'abp.services.app.workFlow', 'workFlowId',
        function ($scope, $uibModalInstance, workFlowService, workFlowId) {
            var vm = this;
            vm.saving = false;
            //首先将workFlow数据设置为null
            vm.workFlow = null;

             

            //触发保存方法
            vm.save = function () {
                vm.saving = true;
                workFlowService.createOrUpdateWorkFlowAsync({ workFlowEditDto:vm.workFlow }).then(function() {
                    abp.notify.info(app.localize('SavedSuccessfully'));
                    $uibModalInstance.close();
                }).finally(function() {
                    vm.saving = false;
                });


            };
            //取消关闭页面
            vm.cancel = function () {
                $uibModalInstance.dismiss();
            };

            //初始化页面
            function init() {
             //   console.log(workFlowId);
                workFlowService.getWorkFlowForEditAsync({
                    id: workFlowId
                }).then(function (result) {
              //      console.log(result);
                    //console.log(result.data);
                    vm.workFlow = result.data.workFlow;
					
																																																																			 
				 

                });
            }
            //执行初始化方法
            init();
        }
    ]);
})();